#ifndef __DEVICE_H__
#define __DEVICE_H__
/////////////////
//include
/////////////////
#include<Windows.h>
#include<D3D11.h>
#include<D3DX11.h>
#include"../CXBurst/Array.h"
#include"Vector3D.h"
#include"InputElement.h"

/////////////////
//const
/////////////////

/////////////////
//class
/////////////////
class Model;
class Device
{
public:
	Device(ID3D11Device* device = NULL);
	~Device();
	ID3D11RenderTargetView* CreateRenderTargetView(ID3D11Resource* resource,D3D11_RENDER_TARGET_VIEW_DESC* render_target_view_desc = NULL);
	ID3D11DepthStencilView* CreateDepthStencilView();
	ID3D11DepthStencilView* CreateShadowDepthStencilView(ID3D11Texture2D* tex);
	ID3D11DepthStencilState* CreateDepthStencilState();
	ID3D11RasterizerState* CreateRasterizerState();
	ID3D11Buffer* CreateVertexBuffer(void* vertexs,int vertexs_num,int vertex_size);
	ID3D11Buffer* CreateIndexBuffer(void* index,int index_num,int index_size);
	ID3D11Buffer* CreateDepthBuffer(void* depth,int depth_num,int depth_size);
	void CreateShader(const char* file_name,const char* vs_entry_point_name,const char* ps_entry_point_name,D3D11_INPUT_ELEMENT_DESC* input_element,int element_size,ID3D11VertexShader** vertex_shader,ID3D11PixelShader** pixel_shader,ID3D11InputLayout** input_layout);
	ID3D11Buffer* CreateConstantBuffer(void* type,int size);
	ID3D11Texture2D* CreateTexture2D(UINT width,UINT height,DXGI_FORMAT format,D3D11_BIND_FLAG bind_flag,D3D11_USAGE usage,UINT cpu_access);
	ID3D11Texture2D* CreateShadowMap(UINT width,UINT height);
	ID3D11Texture2D* CreateDepth2D();
	ID3D11ShaderResourceView* CreateShaderResource(std::string name);
	ID3D11ShaderResourceView* CreateShaderResource(ID3D11Texture2D* texture);
	ID3D11ShaderResourceView* CreateShadowShaderResource(ID3D11Texture2D* texture);
	ID3D11SamplerState* CreateSamplerState(D3D11_SAMPLER_DESC sampler_desc);
	ID3D11BlendState* CreateBlendState();
	Model* LoadPmdModel(std::string address,std::string file_name);
	ID3D11BlendState* CreateBlendStateAdd();

	ID3D11Device* GetDevice() const{return device;}
private:
	ID3D11Device* device;
};
#endif __DEVICE_H__
